package br.com.mackinvest.dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

import br.com.mackinvest.constants.Constants;
import static java.lang.System.out;

public class DBUtil {
	private static Connection con;
	static{
		try{
			Class.forName("com.mysql.jdbc.Driver");
			//con = DriverManager.getConnection("jdbc:mysql://localhost:3306/mackinvest","root","administrador");
			con = DriverManager.getConnection("jdbc:mysql://localhost:3306/mackinvest","mackinvest","mackinvest");
		}catch(ClassNotFoundException ex){
			out.println(Constants.ERRO_DRIVER_BANCO_DADOS);
		}catch(SQLException ex){
			out.println(Constants.ERRO_CONEXAO_BANCO_DADOS);
			out.println(ex.getMessage());
		}
	}
	public static Connection getConnection(){
		return con;
	}
}
